package org.learn.java.observ.watch;

import java.util.Observable;

public class Watched extends Observable {

	private Integer id;
	//若不赋值，会报空指针异常
	private String name="";
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		if(!this.name.equals(name) ){
			this.name = name;
			setChanged();
			notifyObservers();
		}
	}
	
	
}
